package graphinterface;

import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

import savesystem.PlayerStat;

public class StatLayer {
	
	private Image imageJoueur;
	private Barre barreVie, barreMana;
	
	private int argent = 0;
	
	public StatLayer() throws SlickException{
		this.imageJoueur = new Image("res/mecmoche.png");
		this.barreVie = new Barre(80, 20, 100, 10, 100, Color.green);
		this.barreMana = new Barre(80, 30, 100, 10, 100, Color.cyan);
	}
	
	public void render(GameContainer gc, StateBasedGame game, Graphics g, float x, float y){
		g.drawImage(this.imageJoueur, x+ 10, y+ 10);
		this.barreVie.setPosition(x+ 80, y+ 30);
		this.barreMana.setPosition(x+ 80, y+ 41);
		this.barreVie.render(g);
		this.barreMana.render(g);
		g.setColor(Color.white);
		g.drawString("argent : " + argent, x+ 80, y+ 50);
	}
	
	public void update(GameContainer gc, StateBasedGame game, int delta, PlayerStat p){
		this.barreVie.update(p.vie);
		this.barreMana.update(p.mana);
		this.argent = p.argent;
	}

}
